package google.sites.view.menus.sites;

import dev.tools.view.dialogs.FormDialog;
import google.sites.model.commands.site.CreateSite;
import google.sites.view.View;

import javax.swing.*;

/**
 * Created with IntelliJ IDEA.
 * User: Nuno
 * Date: 01-10-2013
 * Time: 17:14
 */
public class SitesNewDialog extends FormDialog<CreateSite> {
    private final JTextField titleTextField;
    private final JTextArea summaryTextArea;

    public SitesNewDialog() {
        super(View.INSTANCE, new CreateSite());
        titleTextField = addField("title", new JTextField());
        summaryTextArea = addField("summary", new JTextArea());
    }

    @Override
    protected void onExecuting() {
        command
                .setTitle(titleTextField.getText())
                .setSummary(summaryTextArea.getText());
    }
}
